﻿/*
* Copyright 2004-2010 mb_sx@hotmail.com
* All Rights Reserved.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace DeskNotes
{
    public partial class ReminderControl : UserControl
    {   
        [Flags]
        public enum CenterStyle { 
            Horizontally = 0x01, 
            Vertically = 0x02
        };

        public ReminderControl()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Centers the control Horizontally and or Vertically inside its parent
        /// </summary>
        /// <param name="style"></param>
        public void Center(CenterStyle style)
        {
            Control parent = this.Parent;
            int x, y;
            if (CenterStyle.Horizontally == (style & CenterStyle.Horizontally ))
            {
                x = (parent.Width / 2) - (this.Width / 2);
                this.Left = x;
            }

            if (CenterStyle.Vertically == (style & CenterStyle.Vertically))
            {
                y = (parent.Height / 2) - (this.Height / 2);
                this.Top = y;
            }
        }

        /// <summary>
        /// Strikouts the font in labe or set regular font
        /// </summary>
        public bool StrikeoutFont
        {
            set
            {
                if (value)
                    LabelTime.Font = new Font(LabelTime.Font.Name, LabelTime.Font.Size, FontStyle.Strikeout);
                else
                    LabelTime.Font = new Font(LabelTime.Font.Name, LabelTime.Font.Size, FontStyle.Regular);
            }
        }

        /// <summary>
        /// Sets the text to control label
        /// </summary>
        public string Label
        {
            set
            {
                this.LabelTime.Text = value;
            }
            get
            {
                return this.LabelTime.Text;
            }
        }
        /// <summary>
        /// Propagates the change of font into label from control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReminderControl_FontChanged(object sender, EventArgs e)
        {
            LabelTime.Font = this.Font;
        }

        private void ReminderControl_MouseHover(object sender, EventArgs e)
        {
            NoteForm parent = (NoteForm)this.ParentForm;
            parent.NoteForm_MouseHover(sender, e);
        }

        private void ReminderControl_Enter(object sender, EventArgs e)
        {
            Logger.WriteLine("ReminderControl Enter event called");
        }

        private void ReminderControl_Click(object sender, EventArgs e)
        {
            Logger.WriteLine("ReminderControl Click event called");
        }
    }
}
